package com.swinw.asumall.order.vo;

import lombok.Getter;
import lombok.Setter;

import java.math.BigDecimal;
import java.util.List;

public class OrderConfirmVo {

    //用户的收获地址列表
    @Setter
    @Getter
    private List<MemberAddressVo> address;

    //所有被选中的购物项
    @Setter
    @Getter
    private List<OrderItemVo> items;

    //用户积分
    @Setter
    @Getter
    private Integer integration;

    //订单总额
    private BigDecimal total;

    //应付价格
    private BigDecimal payPrice;

    @Setter
    @Getter
    private String token;

    public BigDecimal getTotal(){
        BigDecimal sum = new BigDecimal("0");
        if(items != null && items.size() > 0){
            for(OrderItemVo orderItemVo : items){
                sum = orderItemVo.getTotalPrice().add(sum);
            }
        }
        return sum;
    }

    public BigDecimal getPayPrice() {
        return total;
    }

}
